#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
struct stu
{
	long num;
	long score;
	struct stu* next;
};
void addslist(struct stu** head, int num, int score)
{
	struct stu* point = malloc(sizeof(struct stu));
	point->num = num;
	point->score = score;
	point->next = NULL;
	if (*head == NULL)
	{
		*head = point;
	}
	else
	{
		if ((*head)->num > num)
		{
			point->next = *head;
			*head = point;
		}
		else if((*head)->num<num&&(*head)->next==NULL)
		{
			(*head)->next = point;
		}
		else
		{
			struct stu* src = *head;
			while (num > src->next->num && src->next->next != NULL)
			{
				src = src->next;
			}
			if (num < src->next->num)
			{
				point->next = src->next;
				src->next = point;
			}
			else if (num > src->next->num &&src->next->next == NULL)
			{
				src->next->next = point;
			}
		}
	}
}
void printslist(struct stu* head, int rank)
{
   int i = 1;
   struct stu* src = head;
   while (i < rank)
   {
	   src = src->next;
	   i++;
   }
   printf("%d\n", src->score);
}
int main()
{
	int q = 0;
	scanf("%d", &q);
	int i = 0;
	struct stu* slist = NULL;
	for (i = 0; i < q; i++)
	{
		int j = 0;
		scanf("%d", &j);
		if (j == 1)
		{
			int num, score;
			scanf("%d%d", &num, &score);
			addslist(&slist, num, score);
		}
		else if(j==2)
		{
			int rank = 0;
			scanf("%d", &rank);
			printslist(slist,rank);
		}
	}

	return 0;
}